In [1]:
%matplotlib inline
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import plotly as py
#import chart_studio.plotly
import seaborn as sns
import os
from sklearn.neighbors import KNeighborsClassifier
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import accuracy_score, classification_report,confusion_matrix
from sklearn.utils.multiclass import unique_labels
from sklearn.linear_model import LogisticRegression
import plotly.figure_factory as ff
In [2]:
ufc = pd.read_csv(os.path.join("resources/clean2.csv"))
ufc.head()
Out[2]:
Unnamed: 0 BPrev BStreak B_Age B_Height B_ID B_Weight B__Round1_Grappling_Reversals_Landed B__Round1_Grappling_Standups_Landed B__Round1_Grappling_Submissions_Attempts ... R__Round5_TIP_Ground Time R__Round5_TIP_Guard Control Time R__Round5_TIP_Half Guard Control Time R__Round5_TIP_Misc. Ground Control Time R__Round5_TIP_Mount Control Time R__Round5_TIP_Neutral Time R__Round5_TIP_Side Control Time R__Round5_TIP_Standing Time winby winner
0 0 1 1 23 182 2783 84 0 1 1 ... 0 0 0 0 0 0 0 0 DEC red
1 1 0 0 32 175 2208 70 0 0 0 ... 0 0 0 0 0 0 0 0 SUB blue
2 2 2 0 38 172 721 70 0 0 0 ... 0 0 0 0 0 0 0 0 KO/TKO red
3 3 0 0 23 170 2825 56 0 0 0 ... 0 0 0 0 0 0 0 0 SUB blue
4 4 3 1 30 167 2260 61 0 0 0 ... 0 0 0 0 0 0 0 0 DEC red

5 rows × 889 columns

In [3]:
import plotly.figure_factory as ff
import numpy as np

# Add histogram data
x1 = ufc.B_Age
x2 = ufc.R_Age

# Group data together
hist_data = [x1, x2]

group_labels = ['B_Age', 'R_Age']

# Create distplot with custom bin_size
fig = ff.create_distplot(hist_data, group_labels, bin_size=[0, 5, 10])
fig.show()
In [4]:
import plotly.figure_factory as ff
import numpy as np

# Add histogram data
x1 = ufc.B_Weight
x2 = ufc.R_Weight

# Group data together
hist_data = [x1, x2]

group_labels = ['B_Weight', 'R_Weight']

# Create distplot with custom bin_size
fig = ff.create_distplot(hist_data, group_labels, bin_size=[0, 5, 10])
fig.show()
In [5]:
import plotly.figure_factory as ff
import numpy as np

# Add histogram data
x1 = ufc.B_Height
x2 = ufc.R_Height

# Group data together
hist_data = [x1, x2]

group_labels = ['B_Height', 'R_Height']

# Create distplot with custom bin_size
fig = ff.create_distplot(hist_data, group_labels, bin_size=[0, 5, 10])
fig.show()
In [6]:
import plotly.figure_factory as ff
import numpy as np

# Add histogram data
x1 = ufc.B_Height
x2 = ufc.R_Height

# Group data together
hist_data = [x1, x2]

group_labels = ['B_Height', 'R_Height']

# Create distplot with custom bin_size
fig = ff.create_distplot(hist_data, group_labels, bin_size=[0, 5, 10])
fig.show()
In [7]:
from plotly.offline  import download_plotlyjs,init_notebook_mode,plot, iplot
from plotly.offline import init_notebook_mode, iplot
init_notebook_mode(connected=True)
temp = ufc.B_Age.value_counts()
fig = {
  "data": [
    {
      "values": temp.values,
      "labels": temp.index,
      "domain": {"x": [0, 1]},
      "hole": .6,
      "type": "pie"
    },
    
    ],
  "layout": {
        "title":"B_Age",
        "annotations": [
            {
                "font": {
                    "size": 17
                },
                "showarrow": False,
                "text": "B_Age",
                "x": 0.5,
                "y": 0.5
            }
            
        ]
    }
}
iplot(fig, filename='donut')
In [8]:
from plotly.offline  import download_plotlyjs,init_notebook_mode,plot, iplot
from plotly.offline import init_notebook_mode, iplot
init_notebook_mode(connected=True)
temp = ufc.R_Age.value_counts()
fig = {
  "data": [
    {
      "values": temp.values,
      "labels": temp.index,
      "domain": {"x": [0, 1]},
      "hole": .6,
      "type": "pie"
    },
    
    ],
  "layout": {
        "title":"R_Age",
        "annotations": [
            {
                "font": {
                    "size": 17
                },
                "showarrow": False,
                "text": "R_Age",
                "x": 0.5,
                "y": 0.5
            }
            
        ]
    }
}
iplot(fig, filename='donut')
In [9]:
from plotly.offline  import download_plotlyjs,init_notebook_mode,plot, iplot
from plotly.offline import init_notebook_mode, iplot
init_notebook_mode(connected=True)
temp = ufc.B_Height.value_counts()
fig = {
  "data": [
    {
      "values": temp.values,
      "labels": temp.index,
      "domain": {"x": [0, 1]},
      "hole": .6,
      "type": "pie"
    },
    
    ],
  "layout": {
        "title":"B_Height",
        "annotations": [
            {
                "font": {
                    "size": 17
                },
                "showarrow": False,
                "text": "B_Height",
                "x": 0.5,
                "y": 0.5
            }
            
        ]
    }
}
iplot(fig, filename='donut')
In [10]:
from plotly.offline  import download_plotlyjs,init_notebook_mode,plot, iplot
from plotly.offline import init_notebook_mode, iplot
init_notebook_mode(connected=True)
temp = ufc.R_Height.value_counts()
fig = {
  "data": [
    {
      "values": temp.values,
      "labels": temp.index,
      "domain": {"x": [0, 1]},
      "hole": .6,
      "type": "pie"
    },
    
    ],
  "layout": {
        "title":"R_Height",
        "annotations": [
            {
                "font": {
                    "size": 17
                },
                "showarrow": False,
                "text": "R_Height",
                "x": 0.5,
                "y": 0.5
            }
            
        ]
    }
}
iplot(fig, filename='donut')
In [11]:
from plotly.offline  import download_plotlyjs,init_notebook_mode,plot, iplot
from plotly.offline import init_notebook_mode, iplot
init_notebook_mode(connected=True)
temp = ufc.B_Weight.value_counts()
fig = {
  "data": [
    {
      "values": temp.values,
      "labels": temp.index,
      "domain": {"x": [0, 1]},
      "hole": .6,
      "type": "pie"
    },
    
    ],
  "layout": {
        "title":"B_Weight",
        "annotations": [
            {
                "font": {
                    "size": 17
                },
                "showarrow": False,
                "text": "B_Weight",
                "x": 0.5,
                "y": 0.5
            }
            
        ]
    }
}
iplot(fig, filename='donut')
In [12]:
from plotly.offline  import download_plotlyjs,init_notebook_mode,plot, iplot
from plotly.offline import init_notebook_mode, iplot
init_notebook_mode(connected=True)
temp = ufc.R_Weight.value_counts()
fig = {
  "data": [
    {
      "values": temp.values,
      "labels": temp.index,
      "domain": {"x": [0, 1]},
      "hole": .6,
      "type": "pie"
    },
    
    ],
  "layout": {
        "title":"R_Weight",
        "annotations": [
            {
                "font": {
                    "size": 17
                },
                "showarrow": False,
                "text": "R_Weight",
                "x": 0.5,
                "y": 0.5
            }
            
        ]
    }
}
iplot(fig, filename='donut')
In [13]:
from plotly.offline  import download_plotlyjs,init_notebook_mode,plot, iplot
from plotly.offline import init_notebook_mode, iplot
init_notebook_mode(connected=True)
temp = ufc.winner.value_counts()
fig = {
  "data": [
    {
      "values": temp.values,
      "labels": temp.index,
      "domain": {"x": [0, 1]},
      "hole": .6,
      "type": "pie"
    },
    
    ],
  "layout": {
        "title":"Who is the winner?",
        "annotations": [
            {
                "font": {
                    "size": 17
                },
                "showarrow": False,
                "text": "Winner",
                "x": 0.5,
                "y": 0.5
            }
            
        ]
    }
}
iplot(fig, filename='donut')
In [14]:
from plotly.offline  import download_plotlyjs,init_notebook_mode,plot, iplot
from plotly.offline import init_notebook_mode, iplot
init_notebook_mode(connected=True)
temp = ufc.winby.value_counts()
fig = {
  "data": [
    {
      "values": temp.values,
      "labels": temp.index,
      "domain": {"x": [0, 1]},
      "hole": .6,
      "type": "pie"
    },
    
    ],
  "layout": {
        "title":"Who was the winner of the fight?",
        "annotations": [
            {
                "font": {
                    "size": 17
                },
                "showarrow": False,
                "text": "Winby",
                "x": 0.5,
                "y": 0.5
            }
            
        ]
    }
}
iplot(fig, filename='donut')
In [ ]: